package golf;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import database.DAO;

public class Character {
	int no;
	String name;
	int exp;
	int enzi;
	int level;
	int tired;
	int prop_no;
	int avg_stroke_no;
	int avg_putting_no;
	int recent_avg_hand;
	int holeinone_cnt;
	int high_distance;
	int grade_no;
	int model_no;
	String passTest;
	int stat_point;
	
	CharacterGrade grade;
	Model model;
	Property property;


	
	

	public Character(){
		
	}
	/*
	 * CHARNO	NUMBER(38,0)
CHARNM	VARCHAR2(20 BYTE)
EXP	NUMBER(38,0)
ENZI	NUMBER(38,0)
LEV	NUMBER(38,0)
TIRED	NUMBER(38,0)
PROPNO	NUMBER(38,0)
AVGSTROKENO	NUMBER(38,0)
AVGPTNO	NUMBER(38,0)
RECAVGHAND	NUMBER(38,0)
HIOCNT	NUMBER(38,0)
HIGHDISTANCE	NUMBER(38,0)
CHARGRADENO	NUMBER(38,0)
MODELNO	NUMBER(38,0)
	 */
	public Character(ResultSet rs ){
		try {
			setNo( rs.getInt("CHARNO") );
			setName(rs.getString("CHARNM"));
			setExp(rs.getInt("EXP"));
			setEnzi(rs.getInt("ENZI"));
			setLevel(rs.getInt("LEV"));
			setTired(rs.getInt("TIRED"));
			setProp_no(rs.getInt("PROPNO"));
			setAvg_stroke_no(rs.getInt("AVGSTROKENO"));
			setAvg_putting_no(rs.getInt("AVGPTNO"));
			setRecent_avg_hand(rs.getInt("RECAVGHAND"));
			setHoleinone_cnt(rs.getInt("HIOCNT"));
			setHigh_distance(rs.getInt("HIGHDISTANCE"));
			setGrade_no(rs.getInt("CHARGRADENO"));
			setModel_no(rs.getInt("MODELNO"));
			setPassTest(rs.getString("PASSTEST"));
			setStat_point(rs.getInt("STATPOINT"));
			
			property = DAO.getInstance().getCharacterProperty(getNo());
			model = DAO.getInstance().getModel(getModel_no());
			grade = DAO.getInstance().getCharacterGrade(getGrade_no());
			//grade = new CharacterGrade(rs);
			//model = new Model(rs);
			
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public int getNo() {
		return no;
	}
	public void setNo(int no) {
		this.no = no;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getExp() {
		return exp;
	}
	public void setExp(int exp) {
		this.exp = exp;
	}
	public int getEnzi() {
		return enzi;
	}
	public void setEnzi(int enzi) {
		this.enzi = enzi;
	}
	public int getLevel() {
		return level;
	}
	public void setLevel(int level) {
		this.level = level;
	}
	public int getTired() {
		return tired;
	}
	public void setTired(int tired) {
		this.tired = tired;
	}
	public int getProp_no() {
		return prop_no;
	}
	public void setProp_no(int prop_no) {
		this.prop_no = prop_no;
	}
	public float getAvg_stroke_no() {
		return avg_stroke_no;
	}
	public void setAvg_stroke_no(int avg_stroke_no) {
		this.avg_stroke_no = avg_stroke_no;
	}
	public float getAvg_putting_no() {
		return avg_putting_no;
	}
	public void setAvg_putting_no(int avg_putting_no) {
		this.avg_putting_no = avg_putting_no;
	}
	public int getRecent_avg_hand() {
		return recent_avg_hand;
	}
	public void setRecent_avg_hand(int recent_hand) {
		this.recent_avg_hand = recent_hand;
	}
	public int getHoleinone_cnt() {
		return holeinone_cnt;
	}
	public void setHoleinone_cnt(int holeinone_cnt) {
		this.holeinone_cnt = holeinone_cnt;
	}
	public int getHigh_distance() {
		return high_distance;
	}
	public void setHigh_distance(int high_distance) {
		this.high_distance = high_distance;
	}
	
	public int getGrade_no() {
		return grade_no;
	}
	public void setGrade_no(int grade_no) {
		this.grade_no = grade_no;
	}
	public int getModel_no() {
		return model_no;
	}
	public void setModel_no(int model_no) {
		this.model_no = model_no;
	}
	
	public CharacterGrade getGrade() {
		return grade;
	}
	public void setGrade(CharacterGrade grade) {
		this.grade = grade;
	}
	public Model getModel() {
		return model;
	}
	public void setModel(Model model) {
		this.model = model;
	}
	public Property getProperty() {
		return property;
	}
	public void setProperty(Property property) {
		this.property = property;
	}

	public void setPassTest(String c) {
		this.passTest = c;
	}
	
	public String getPassTest() {
		return passTest;
	}
	

	public int getStat_point() {
		return stat_point;
	}
	public void setStat_point(int stat_point) {
		this.stat_point = stat_point;
	}


	public static class CharacterGrade{
		public static final char YES = 'Y';
		public static final char NO = 'N';
		int no;
		String name;
		int limit_level;
		int limit_hand;
		char testYN;
		float exp_given_percent;
		int enzi_given;
		
		public CharacterGrade(){}
		/*
		 * CHARGRADENO	NUMBER(38,0)
		CHARGRADENM	VARCHAR2(20 BYTE)
		CHARGRADELIMITLEV	NUMBER(38,0)
		CHARGRADELIMITHAND	NUMBER(38,0)
		CHARGRADETESTYN	CHAR(1 BYTE)
		CHARGRADEGIVENEXP	FLOAT
		CHARGRADEGIVENENZI	NUMBER(38,0)
		 */
		public CharacterGrade(ResultSet rs){
			try {
				setNo( rs.getInt("CHARGRADENO") );
				setName(rs.getString("CHARGRADENM"));
				setLimit_hand( rs.getInt("CHARGRADELIMITHAND") );
				setLimit_level( rs.getInt("CHARGRADELIMITLEV") );
				setTestYN( rs.getString("CHARGRADETESTYN").charAt(0) );
				setExp_given_percent(rs.getFloat("CHARGRADEGIVENEXP"));
				setEnzi_given(rs.getInt("CHARGRADEGIVENENZI"));
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		public int getNo() {
			return no;
		}
		public void setNo(int no) {
			this.no = no;
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public int getLimit_level() {
			return limit_level;
		}
		public void setLimit_level(int limit_level) {
			this.limit_level = limit_level;
		}
		public int getLimit_hand() {
			return limit_hand;
		}
		public void setLimit_hand(int limit_hand) {
			this.limit_hand = limit_hand;
		}
		public char getTestYN() {
			return testYN;
		}
		public void setTestYN(char testYN) {
			this.testYN = testYN;
		}
		public float getExp_given_percent() {
			return exp_given_percent;
		}
		public void setExp_given_percent(float exp_given_percent) {
			this.exp_given_percent = exp_given_percent;
		}
		public int getEnzi_given() {
			return enzi_given;
		}
		public void setEnzi_given(int enzi_given) {
			this.enzi_given = enzi_given;
		}
		
		
	}
}
// 